const http = require('http');

const server = http.createServer();

server.on('request', (request, response) => {
   console.log(`客户端请求头${request.headers}`);
   console.log(`客户端使用http版本${request.httpVersion}`);
   console.log(`客户端请求方法${request.method}`);
   console.log(`客户端请求路径${request.url}`);
});
//要监听的端口、允许通过哪个ip地址访问,开启后的回调
server.listen(3000, '127.0.0.1', () => {
    console.log('server is running a port 3000...');
});